package com.ruoyi.user.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.user.api.RemoteCarUserService;
import com.ruoyi.user.api.domain.CarUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteCarUserFallbackFactory implements FallbackFactory<RemoteCarUserService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteCarUserService.class);

    @Override
    public RemoteCarUserService create(Throwable throwable)
    {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteCarUserService()
        {
            @Override
            public CarUser getUserInfoByUserName(String username, String source) {
                return null;
            }

            @Override
            public CarUser getUserInfoById(Long id, String source) {
                return null;
            }

        };
    }
}
